﻿using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using SubstrateHelper.Models;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;


namespace SubstrateHelper.Data
{
    public class SubstrateHelperDbContext: IdentityDbContext<IdentityUser>
    {
        public SubstrateHelperDbContext( DbContextOptions<SubstrateHelperDbContext> options) : base(options)
        {
           
        }
        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {

            
            //modelBuilder.Entity<SubstrateInfo>().HasIndex(si => si.Thickness);
            //modelBuilder.Entity<SubstrateInfo>().HasIndex(si => si.ScheduledLotNo);
            //modelBuilder.Entity<SubstrateInfo>().HasIndex(si => si.CPA);
            //modelBuilder.Entity<SubstrateInfo>().HasIndex(si => si.ErrorC);

            ////复合主键
            //modelBuilder.Entity<CapacitorType_Mask>().HasKey(tm => new { tm.CapacitorType, tm.MaskName });

            //
            base.OnModelCreating(modelBuilder);

            
        }

        
        public DbSet<SubstrateInfo> SubstrateInfos { get; set; }

        //public DbSet<CapacitorType> CapacitorTypes { get; set; }

        public DbSet<CapacitorMask> CapacitorMasks { get; set; }

        public DbSet<CapacitorType_Mask> CapacitorType_Masks { get; set; }

        public DbSet<CandidateList> CandidateLists { get; set; }

        //public DbSet<SubstrateType> SubstrateTypes { get; set; }

        public DbSet<ProcessBase.Models.Parameter> Parameters { get; set; }

        public DbSet<ProcessBase.Models.Record> Records { get; set; }
        
        public DbSet<ProcessBase.Models.ProcessInputOutput> ProcessInputOutputs { get; set; }

        public DbSet<ProcessBase.Models.ProcessDayLimit> ProcessDayLimits { get; set; }

        public DbSet<ProcessBase.Models.ProcessStatistics> ProcessStatistics { get; set; }

        public DbSet<ProcessBase.Models.ProcessRecordFileCode> ProcessRecordFileCodes { get; set; }

        public DbSet<ProcessBase.Models.Order> Orders { get; set; }

        public DbSet<ProcessBase.Models.ProcessShortName> ProcessShortNames { get; set; }

    }
}
